﻿using ExcelImportHelper;
using System;
using System.Collections.Generic;

namespace ExcelImportDemo
{
    class Program
    {
        static void Main(string[] args)
        { 
            AutomaticOperate automatic = new AutomaticOperate();
            List<Student> stu = automatic.ExcelToEntities<Student>(@"D:\Projects\WindowApp\ExcelImportDemo\Student.xlsx"); 
            stu.ForEach(s => { 
                s.ToString();
            }); 
            Console.ReadLine();
        }
    }

    [ExcelSheet(CheckPropertyName =true)]
    public class Student
    {
        public int ID { get; set; }

        [ExcelField(Name ="姓名",DataType = eFieldDataType.String)]
        public string Name { get; set; }

        [ExcelField(Name = "地址", DataType = eFieldDataType.String)]
        public string Address { get; set; }

        public string Tel { get; set; }

        public int Age { get; set; }

        [ExcelField(Name = "MasterCard", DataType = eFieldDataType.String)]
        public string IDCard { get; set; }

        public new void ToString()
        {
            Console.WriteLine($"ID:{this.ID},Name:{this.Name},Addr:{this.Address},Tel:{this.Tel},Age:{this.Age},IDCard:{this.IDCard}");
        }

    }
}
